Energy Management With Ai: Smart Grids And Optimization